package test1;

public class Test2 {
    public static void main(String[] args) {
        int []arr={423,52345,523425,543,654,754,5,653,3463,63,6};
        A.quickSort(arr,0,arr.length-1);
        A.print(arr);


    }
}

class A{
    public static void quickSort(int []arr,int left,int right){
        if(left>=right){
            return;
        }
        int piv=pation(arr,left,right);

        quickSort(arr,left,piv-1);
        quickSort(arr,piv+1,right);
    }

    public static int pation(int arr[],int start,int end){
        int i=start;
        int pivot=arr[start];

        while(start<end){
            while (start<end&&arr[end]>=pivot){
                end--;
            }
            while (start<end&&arr[start]<=pivot){
                start++;
            }
            swap(arr,start,end);
        }
        swap(arr,start,i);
        return start;
    }

    public static void swap(int []arr,int i,int j){
        int tem=arr[i];
        arr[i]=arr[j];
        arr[j]=tem;
    }

    public static void print(int []arr){
        for(int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
    }
}
